<template>
  <div>
    <el-table :data="tableData" stripe border :max-height="maxTableHeight" style="width: 100%">
      <el-table-column type="index" label="序号" width="50" resizable />
      <el-table-column prop="date" label="商品编号" width="120" resizable sortable show-overflow-tooltip align="left" />
      <el-table-column prop="name" label="商品名称" width="120" resizable />
      <el-table-column prop="name" label="商品类型" width="120" resizable />
      <el-table-column prop="name" label="商户入驻时间" width="120" resizable />
      <el-table-column prop="address" label="商户合同有效期" resizable />
      <el-table-column prop="address" label="创建人" resizable />
      <el-table-column prop="address" label="创建时间" resizable />
      <el-table-column label="操作" align="center" resizable fixed="right" width="300">
        <template slot-scope="scope">
          <el-button size="mini" type="warning" icon="el-icon-edit" plain @click="handleEdit(scope.$index, scope.row)">修改</el-button>
          <el-button size="mini" type="primary" plain @click="handExtension(scope.$index, scope.row)">延长合同</el-button>
          <el-button size="mini" type="danger" icon="el-icon-delete" plain @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <edit ref="edit" />
    <extension ref="extension" />
  </div>

</template>

<script>
import Edit from './Edit.vue'
import extension from './extension.vue'
export default {
  components: {
    Edit,
    extension
  },
  props: {
    maxTableHeight: {
      type: String | Number
    }
  },
  data () {
    return {
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 弄'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }]
    }
  },
  methods: {
    handleEdit () {
      this.$refs.edit.togglePopup(true)
    },
    handExtension () {
      this.$refs.extension.toggleAdd(true)
    }
  }

}
</script>
